#include "msgutils.h"

namespace yc {
namespace msgutils {

QMessageBox::StandardButton msgBox(QWidget* parent, const QString& title, const QString& text,
                                   QMessageBox::StandardButtons buttons,
                                   QMessageBox::StandardButton defaultButton,
                                   QMessageBox::Icon icon)
{
    QMessageBox mb(icon, title, text, buttons, parent);
    mb.setObjectName("normal");
    mb.setDefaultButton(defaultButton);
    mb.setStyleSheet("QLabel#qt_msgbox_label{min-width:360px;margin-bottom:20px;font-size:12px;}"
                     "QPushButton{min-width:60px;}");
    if (text.length() > 100) {
        mb.setDetailedText(text);
    }
    mb.setTextFormat(Qt::AutoText);
    // qt_msgboxex_icon_label
    return QMessageBox::StandardButton(mb.exec());
}

} // namespace msgutils
} // namespace yc
